package com.sk.albumdemo;

import android.os.Bundle;

import androidx.appcompat.app.AppCompatActivity;

import com.bumptech.glide.Glide;
import com.sk.albumdemo.databinding.ActivityMainBinding;
import com.sk.photo_album.AlbumBuilder;
import com.sk.photo_album.AlbumCallBack;
import com.sk.photo_album.Media;
import com.sk.photo_album.MediaInfo;

public class MainActivity extends AppCompatActivity {

    ActivityMainBinding binding;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        binding = ActivityMainBinding.inflate(getLayoutInflater());
        setContentView(binding.getRoot());

        AlbumBuilder.getInstance()
                .setAuthority("com.sk.albumdemo.fileprovider")
                .setMediaType(Media.MEDIA_TYPE_ALL)
                .setMaxSelect(1)
                .setCallBack((AlbumCallBack) result -> {
                    StringBuilder builder = new StringBuilder();
//                    for (MediaInfo mediaInfo : result) {
//                        builder.append(mediaInfo.getPath());
//                    }
                    Glide.with(this)
                            .load(result.get(0))
                            .into(binding.image);
//                    binding.info.setText(builder.toString());
                })
                .start(this);
    }
}